<template>
  <a-config-provider :locale="locale">
    <div id="app">
      <router-view />
    </div>
  </a-config-provider>
</template>
<script>
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
import enquireScreen from '@/utils/device'
import { getAction } from '@/api/manage'

export default {
  data() {
    return {
      locale: zhCN,
      url: '/sys/closeTime',
    }
  },
  methods: {
    closeWindow() {
      getAction(this.url).then((res) => {})
    },
  },
  mounted() {
    window.onbeforeunload = (e) => {
      e = e || window.event
      if (e) {
        e.returnValue = '关闭提示'
      }
      this.closeWindow() //调用自己的方法
      // Chrome, Safari, Firefox 4+, Opera 12+ , IE 9+
      return '关闭提示'
    }
  },
  created() {
    let that = this
    enquireScreen((deviceType) => {
      // tablet
      if (deviceType === 0) {
        that.$store.commit('TOGGLE_DEVICE', 'mobile')
        that.$store.dispatch('setSidebar', false)
      }
      // mobile
      else if (deviceType === 1) {
        that.$store.commit('TOGGLE_DEVICE', 'mobile')
        that.$store.dispatch('setSidebar', false)
      } else {
        that.$store.commit('TOGGLE_DEVICE', 'desktop')
        that.$store.dispatch('setSidebar', true)
      }
    })
  },
}
</script>
<style lang="less">
#app {
  height: 100%;
}
pre {
  white-space: pre-wrap !important;
  word-wrap: break-word !important;
}
.main {
  height: 100%;
  overflow: auto;
}
.ant-btn-primary {
  background-color: #3154a4 !important;
  border-color: #3154a4 !important;
  color: white !important;
}
/* button 添加ghost属性-会出现这个类 */
.ant-btn-background-ghost {
  color: #3154a4 !important;
}
.ant-btn-primary[disabled] {
  color: rgba(0, 0, 0, 0.25) !important;
  background-color: #f5f5f5 !important;
  border-color: #d9d9d9 !important;
  text-shadow: none !important;
  box-shadow: none !important;
}
.ant-modal-footer button {
  margin-left: 8px !important;
}
.ant-table a {
  color: #3154a4;
}
.ant-table a:hover {
  color: orange;
}
// /deep/.ant-tabs-nav-wrap {
//   /deep/ .ant-tabs-nav {
//
//   }
//   /deep/.ant-tabs-nav .ant-tabs-tab:hover {
//     color: orange;
//   }
// }
.ant-tabs-nav .ant-tabs-tab:hover {
  color: orange !important;
}
.ant-tabs-tab-active {
  color: #3154a4 !important;
}
//分页器
.ant-pagination-item-active {
  border-color: #3154a4 !important;
  a {
    color: #3154a4 !important;
  }
}
.table-page-search-submitButtons {
  a:hover {
    color: orange !important;
  }
  a {
    color: #3154a4 !important;
  }
}
.ant-pagination-item-active:hover {
  border-color: orange !important;
  a {
    color: orange !important;
  }
}
// button按钮
.ant-btn:hover {
  color: orange !important;
  border-color: orange !important;
}
// .ant-select-dropdown {
//   width: 300px;
// }
.ant-checkbox-disabled .ant-checkbox-inner {
  background-color: rgba(191, 191, 191, 0.5) !important;
}
</style>